package com.neusoft.neuiotms.dcam.fixed.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

import org.hibernate.validator.constraints.Length;

import com.neusoft.bizcore.web.jpa.model.AbstractModel;
import com.neusoft.bizcore.web.jpa.model.Comment;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@ToString
@Entity
@org.hibernate.annotations.Table(appliesTo = "neuiot_fixed_spare_type", comment = "备品备件类型表")
@Table(name = "neuiot_fixed_spare_type")
public class SpareType extends AbstractModel {

    private static final long serialVersionUID = 1L;

    /** 分类名称 */
    @NotBlank(message = "分类名称不能为空")
    @Length(max = 255, message = "分类名称不能超过{max}位")
    @Column(length = 255, nullable = true)
    @Comment("varchar(255) NOT NULL COMMENT '分类名称'")
    private String name;

    /** 分类编码 */
    @NotBlank(message = "分类编码不能为空")
    @Length(max = 255, message = "分类编码不能超过{max}位")
    @Column(length = 255, unique = true)
    @Comment("varchar(255) NOT NULL COMMENT '分类编码'")
    private String code;

    /** 计量单位 */
    @Length(max = 255, message = "计量单位不能超过{max}位")
    @Column(length = 255, nullable = false)
    @Comment("varchar(255) NOT NULL COMMENT '计量单位'")
    private String unit;

    @ManyToOne
    @Comment("bigint(20) NOT NULL COMMENT '资产分类'")
    private AssetType parent;

}
